/**
 * 
 */
var dmIds="";
var posYs=0;
var ietmCurrentPos=0;	//历史当前位置
var ietmHistoryArr=[]; //历史记录
$(function(){
	adaptive();
	toggleMenu();
	   //隐藏首页左边菜单
	setInterval("GetTime()", 1000);
	$('#fitness').click(function(e){
        e.preventDefault();
        var diag = new $.Zebra_Dialog({
            source: {'iframe': {
            	'id':'fitness',
                'src':'/ietm/fitness',
                'height':400,
            }},
            width:600,
            title:'适用性',
            buttons: ['确定']
        });
	});
});

document.addEventListener('DOMContentLoaded', function (event) {
    // chrome 浏览器直接加上下面这个样式就行了，但是ff不识别
    document.body.style.zoom = 'reset';
    document.addEventListener('keydown', function (event) {
        if ((event.ctrlKey === true || event.metaKey === true)
        && (event.which === 61 || event.which === 107
            || event.which === 173 || event.which === 109
            || event.which === 187  || event.which === 189))
            {
               event.preventDefault();
            }
    }, false);
    document.addEventListener('mousewheel DOMMouseScroll', function (event) {
        if (event.ctrlKey === true || event.metaKey) {
            event.preventDefault();
        }
    }, false);
}, false);

function ietmGoBack(){
	var lastPos = ietmCurrentPos;
	ietmCurrentPos = (ietmCurrentPos <= 0 ? 0 : (ietmCurrentPos-1));
    if (lastPos == ietmCurrentPos){
        return;
    }
    var currentPath = ietmHistoryArr[ietmCurrentPos];
    if (ietmHistoryArr[lastPos] == currentPath){ // 如果一样，则继续向后寻找
    	ietmGoBack();
        return;
    }
    if(0==ietmCurrentPos){
    	ietmCurrentPos=0;
    	ietmHistoryArr=['ietm-home'];
    }
    //changeMain(currentPath);
    if(currentPath.indexOf('ietm-home?')>-1){
    	var dmId = currentPath.substring(currentPath.indexOf('?')+1);
    	if(ietmHistoryArr[ietmCurrentPos+1].indexOf('ietm-home?')>-1){
    		var node = zTree.getNodeByParam("id",dmId);
    		zTree.expandNode(node, true, true, true);//展开该节点及所有子节点
            zTree.selectNode(node);
            isDisable(node);
    	}
    	else{
    	$("#frameReft").load("ietm-home.html?random="+Math.random(),function(){
    		var node = zTree.getNodeByParam("id",dmId);
    		zTree.expandNode(node, true, true, true);//展开该节点及所有子节点
            zTree.selectNode(node);
            isDisable(node);
    	});
    	}
    }
    else{
    $("#frameReft").load(currentPath+".html?random="+Math.random(),function(){});
    }
	}